//
// Created by spiro on 19-4-9.
//

#ifndef TEST_SORT_ALGORITHM_TEST_PREPARE_H
#define TEST_SORT_ALGORITHM_TEST_PREPARE_H

#include <stdbool.h>

/**
 * Generate random array
 * @param arr
 * @param len
 * @return
 */
void gen_rand_arr(int * arr, int len);

/**
 * Generate ordered array
 * @param arr
 * @param len
 */
void gen_ordered_arr(int * arr, int len);

/**
 * Generate nearly ordered array:
 *  firstly generate ordered array,
 *  then select two random position to swap, execute <swapTimes> times.
 * @param arr
 * @param len
 * @param swapTimes
 * @return
 */
void gen_nearly_ordered_arr(int * arr, int len, int swapTimes);

/**
 * Generate reverse ordered array
 * @param arr
 * @param len
 * @return
 */
void gen_reverse_arr(int * arr, int len);

/**
 * Determine whether the arr is sorted.
 * @param arr
 * @param len
 * @return
 */
bool is_sorted(int * arr, int len);


#endif //TEST_SORT_ALGORITHM_TEST_PREPARE_H
